home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 155 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  42 lines

  1. Newsgroups: comp.std.c++
  2. Path: cs.mu.OZ.AU!bounce-back
  3. From: John Max Skaller <maxtal@suphys.physics.su.oz.au>
  4. Subject: typeinfo
  5. Message-ID: <310B7660.4116@suphys.physics.su.oz.au>
  6. Originator: fjh@munta.cs.mu.OZ.AU
  7. Sender: news@cs.mu.OZ.AU (CS-Usenet)
  8. Organization: MAXTAL
  9. X-Original-Date: Sun, 28 Jan 1996 23: 13:04 +1000
  10. Date: Mon, 29 Jan 1996 00:05:04 GMT
  11. Approved: fjh@cs.mu.oz.au
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMQwPbeEDnX0m9pzZAQFDJAGAhWeXSz6cXyPrIVvgAsGdVOKvrSCE6VWY
  14.     Hwh+tIkeg9nycMDBwTyS8nK2OvKdgZVb
  15.     =7XmX
  16. X-Mailer: Mozilla 2.0b6a (WinNT; I)
  17.  
  18. > class beatha{public:virtual ~beatha(){};}
  19. > class duine:public beatha{};
  20. > class gael: public duine {};
  21. > beatha *pd=new gael;
  22. > if(typeid(pd)==typeid(duine)
  23. > {       cout<<"duine";
  24. > }
  25. > ...
  26. > does "duine" get printed here or not?
  27.  
  28. No. pd denotes an object of exact type "gael".
  29. This is not the same type as "duine".
  30. [Note "beatha" is polymorphic]
  31.  
  32. -- 
  33. John Max Skaller               voice: 61-2-566-2189
  34. 81 Glebe Point Rd              fax:   61-2-660-0850
  35. GLEBE NSW 2037                 web: http://www.maxtal.com.au/~skaller/
  36. AUSTRALIA                      email: skaller@maxtal.com.au
  37. ---
  38. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  39.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  40.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  41.